package com.wicket.okrbff.web.contorller;

import com.wicket.okrapp.common.ro.OkrResult;
import com.wicket.okrapp.dal.po.mbg.OmsDualHighIndicatorRelationship;
import com.wicket.okrbff.biz.service.DualHighIndicatorRelationshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * @author CHS
 * @since 2025-10-02
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/oms/dual/high/indicator/relationship/")
public class DualHighIndicatorRelationshipController {

    @Autowired
    DualHighIndicatorRelationshipService service;


    /**
     * 修改-双高建设任务绩效关系
     */
    @PostMapping("change")
    public OkrResult<Boolean> change(@RequestBody @Validated OmsDualHighIndicatorRelationship obj){
        System.out.println("===========================");
        return OkrResult.success(service.changeDualHighIndicatorRelationship(obj));
    }

    /**
     * 新增-双高建设任务绩效关系
     */
    @PostMapping("add")
    public OkrResult<String> add(@RequestBody @Validated OmsDualHighIndicatorRelationship obj){
        return OkrResult.success(service.addDualHighIndicatorRelationship(obj));
    }

    /**
     * 修改-双高建设任务绩效关系
     */
    @PostMapping("update")
    public OkrResult<Boolean> update(@RequestBody @Validated OmsDualHighIndicatorRelationship obj){
        return OkrResult.success(service.updateDualHighIndicatorRelationship(obj));
    }

    /**
     * 删除-双高建设任务绩效关系
     */
    @PostMapping("delete")
    public OkrResult<Boolean> delete(@RequestBody @Validated OmsDualHighIndicatorRelationship obj){
        return OkrResult.success(service.deleteDualHighIndicatorRelationship(obj.getDualHighId()));
    }

    /**
     * 列表-双高建设任务绩效关系
     */
    @PostMapping("list")
    public OkrResult<ArrayList<OmsDualHighIndicatorRelationship>> list(@RequestBody @Validated OmsDualHighIndicatorRelationship obj){
        return OkrResult.success(new ArrayList<>(service.queryDualHighIndicatorRelationshipList(obj)));
    }

    /**
     * 详情-双高建设任务绩效关系
     */
    @PostMapping("detail")
    public OkrResult<OmsDualHighIndicatorRelationship> detail(@RequestBody @Validated OmsDualHighIndicatorRelationship obj){
        return OkrResult.success(service.queryDualHighIndicatorRelationshipDetail(obj));
    }

}
